<?php


namespace App\Transformers;


use App\Models\MerchantRegister;
use App\Models\User;
use League\Fractal\TransformerAbstract;

class MerchantRegistersTransformer extends TransformerAbstract
{
    public function transform(MerchantRegister $data)
    {
        return [
            'id' => $data->id,
            'user_id'=>$data->user_id ?? '',
            'class'=>$data->class ?? '',
            'name'=>$data->name ?? '',
            'username'=>$data->username ?? '',
            'password'=>$data->password ?? '',
            'move_show'=>$data->move_show ?? '',
            'banner'=>$data->banner ?? '',
            'brief'=>$data->brief ?? '',
            'avatar'=>$data->avatar ?? '',
            'principal_name'=>$data->principal_name ?? '',
            'principal_phone'=>$data->principal_phone ?? '',
            'license'=>$data->license ?? '',
            'keyword'=>$data->keyword ?? '',
            'service_phone'=>$data->service_phone ?? '',
            'province'=>$data->province ?? '',
            'city'=>$data->city ?? '',
            'district'=>$data->district ?? '',
            'detailed_address'=>$data->detailed_address ?? '',
            'fees'=>$data->fees ?? '',
            'add_product_right'=>$data->add_product_right ?? '',
            'open_live_room'=>$data->open_live_room ?? '',
            'add_live_room_product'=>$data->add_live_room_product ?? '',
            'home_recommend'=>$data->home_recommend ?? '',
            'merchant_type'=>$data->merchant_type ?? '',
            'status'=>$data->status ?? '',
            'check_time'=>$data->check_time ?? '',
            'fail_message'=>$data->fail_message ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
